﻿var teamId;
var teamName;
var longitude;
var latitude;
var placeTitle;
var placeContent;
var backHandle;
$(document).ready(function(){ 
	$('#header').animate({'top':'0px'},400);
	teamId = args.teamId; //取得id的值
	teamName = args.teamName;
	longitude = args.longitude;
	latitude = args.latitude;
	placeTitle = args.placeTitle;
	placeContent = args.placeContent;
	backHandle = args.backHandle;
	
	// 百度地图API功能
    var map = new BMap.Map('allmap');
    var poi = new BMap.Point(longitude,latitude);
    map.centerAndZoom(poi, 15);
    map.setCurrentCity("南京");          // 设置地图显示的城市 此项是必须设置的
    map.enableScrollWheelZoom();
    var top_left_navigation = new BMap.NavigationControl();  //左上角，添加默认缩放平移控件
    map.addControl(top_left_navigation);     

    var content = placeContent;

    //创建检索信息窗口对象
    var searchInfoWindow = null;
	searchInfoWindow = new BMapLib.SearchInfoWindow(map, content, {
			title  : placeTitle,      //标题
			//width  : 290,             //宽度
			//height : 105,              //高度
			panel  : "panel",         //检索结果面板
			enableAutoPan : true,     //自动平移
			searchTypes   :[
				BMAPLIB_TAB_TO_HERE,  //到这里去
				BMAPLIB_TAB_FROM_HERE, //从这里出发
				BMAPLIB_TAB_SEARCH   //周边检索
			]
		});
    var marker = new BMap.Marker(poi); //创建marker对象
    marker.enableDragging(); //marker可拖拽
    marker.addEventListener("click", function(e){
	    searchInfoWindow.open(marker);
    })
    map.addOverlay(marker); //在地图中添加marker
    searchInfoWindow.open(marker);

});
function goBack(){
  if (backHandle == 1){
	window.location.href=path+"/soccer/teamGame.jsp?teamId="+teamId+"&teamName="+teamName;
  }else{
	window.location.href=path+"/soccer/teamGame.jsp?teamId="+teamId+"&teamName="+teamName;
  }
}
